package com.example.blog.controller;

import com.example.blog.model.Article;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller

public class IndexController extends  BaseController{
    private SqlSession sqlSession;

    public IndexController(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }
    @RequestMapping(value = "/", method = RequestMethod.GET)
    private String queryArticle(Article article){
        List<Article> articles=sqlSession.selectList("article.queryArticle",article);
        session.setAttribute("articles",articles);
        return "redirect:/index.jsp";
    }
}
